{*include file="template/admin_head.htm"*}

<table id="containtable" cellspacing="0" cellpadding="0" class="{*$cf_controller*}" width="100%">
    <tr>
        <td valign="top" bgcolor="#FFFFFF">


            <div class="wrapper pr_8">
                {*if $cf_action=='add' || $cf_action=='edit'*}

                <script type="text/javascript">
                   
                    $(function(){			
						
                        
						
                        $("#action_form").submit(function(){							
                            if($("#sp_name").val()==''){
                                my_alert('请输入登录用户名','操作提示',"$('#sp_name').focus()");
                                return false;
                            }
							if($("#act").val()=='add' && $("#pwd").val()==''){
                                my_alert('请输入登录密码','操作提示',"$('#pwd').focus()");
                                return false;
                            }         
							
							                  
							if($("#sp_bank_type").val()==''){
                                my_alert('请输入账户类型','操作提示',"$('#sp_bank_type').focus()");
                                return false;
                            }
							if($("#sp_bank_name").val()==''){
                                my_alert('请输入开户人(姓名)','操作提示',"$('#sp_bank_name').focus()");
                                return false;
                            }
							if($("#sp_bank_code").val()==''){
                                my_alert('请输入卡号(账号)','操作提示',"$('#sp_bank_code').focus()");
                                return false;
                            } 
							if($("#sp_title").val()==''){
                                my_alert('请输入商户名称','操作提示',"$('#sp_title').focus()");
                                return false;
                            }
                        });
						
						
						/*("#sp_pname").autocomplete("/admin/ajax-act_searchgoods.htm", {
							minChars: 1,					//最少输入字条
							max: 12,
							autoFill: false,				//是否选多个,用","分开
							mustMatch: true,				//是否全匹配, 如数据中没有此数据,将无法输入
							matchContains: true,			//是否全文搜索,否则只是前面作为标准
							scrollHeight: 200,
							width:700,
							multiple:false,
							dataType:'html',
							formatItem: function(row, i, max) {					//显示格式
							
								return "<span style='width:450px'>"+row[0]+"</span><span style='width:70px'>ID:"+row[1]+"</span><span style='width:80px'>"+row[2]+"元</span>";
							},
							formatMatch: function(row, i, max) {				//以什么数据作为搜索关键词,可包括中文,
							   return row[1];
					
							},
							formatResult: function(row) {					//返回结果		
								return row[0];
							}
						});				
						
						$("#sp_pname").result(function(event, row, formatted) {				//额外触发,可不要
							 $("#sp_pid").val(row[1]);
						});*/
						
						$("#sp_pname").autocomplete("/admin/ajax-act_searchsp.htm", {
							minChars: 1,					//最少输入字条
							max: 12,
							autoFill: false,				//是否选多个,用","分开
							mustMatch: true,				//是否全匹配, 如数据中没有此数据,将无法输入
							matchContains: true,			//是否全文搜索,否则只是前面作为标准
							scrollHeight: 200,
							width:450,
							multiple:false,
							dataType:'html',
							formatItem: function(row, i, max) {					//显示格式
							
								return "<span style='width:140px'>"+row[0]+"</span><span style='width:70px'>ID:"+row[1]+"</span><span style='width:200px'>"+row[2]+"</span>";
							},
							formatMatch: function(row, i, max) {				//以什么数据作为搜索关键词,可包括中文,
							   return row[1];
					
							},
							formatResult: function(row) {					//返回结果		
								return row[0];
							}
						});				
						
						$("#sp_pname").result(function(event, row, formatted) {				//额外触发,可不要
							if(row!=undefined){
								$("#sp_pid").val(row[1]);
							}
							//console.log(row[1]);
						});
						
						
										
						call_uploader('#sp_logo_button','#sp_logo','image',{'show':'#sp_logo_show',"path":"{*$cf_module*}"});
                        {*if $row['sp_logo'] *}
                            $("#sp_logo_show").append(show_photo_div("#sp_logo_button","#sp_logo","{*$row['sp_logo']*}","{*$cf_module*}"));
                        {*/if*}
						
						call_uploader('#sp_licence_button','#sp_licence','image',{'show':'#sp_licence_show',"path":"{*$cf_module*}"});
                        {*if $row['sp_licence'] *}
                            $("#sp_licence_show").append(show_photo_div("#sp_licence_button","#sp_licence","{*$row['sp_licence']*}","{*$cf_module*}"));
                        {*/if*}
                    })

                </script>

                <div class="content_panel_title">
                    <div class="contentpanelleft"></div>
                    <div class="contentpanelcenter">
                        <span class="contentpanelcenter_font">新增/修改代理商</span>
                        <span><a class="edit at" href="{*$cf_self_page*}?dpt={*$cf_dpt*}">代理商管理</a></span>                            </div>
                    <div class="contentpanelrihgt"></div>
                </div>
                <div class="content_table_center_style">
                    <div class="p8">

                        <form name="action_form" id="action_form" method="post" action="{*$cf_self_page*}">
                            <input name="id" id="id" type="hidden" value="{*$row['sp_id']*}" />
                            <input name="dpt" id="dpt" type="hidden" value="{*$cf_dpt*}" />
                            <input name="act" id="act" type="hidden" value="{*$cf_action*}" />
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tbl tbl_nbr">
                                <tbody>
									  <tr>
                                        <td colspan="4" class="stitle">登录信息</td>
                                    </tr>
                                    <tr>
                                        <td align="right">代理商账号:</td>
                                        <td align="left"><input name="sp_name" type="text" id="sp_name" size="30" maxlength="30" value="{*$row['sp_name']*}" /><span class="red">*</span></td>
                                        <td width="11%" align="right">登录密码:</td>
                                        <td width="39%" align="left"><input name="sp_pwd" type="password" id="sp_pwd" value="" size="30" maxlength="30" autocomplete="off" /><span class="red">*</span>{*if $cf_action=='edit'*}(<span class="red">如不修改则留空</span>){*/if*}</td>
                                    </tr>
                                    <tr>
                                    	<td align="right">父级代理商:</td>
                                    	<td align="left"><input name="sp_pname" type="text" id="sp_pname" size="30" maxlength="30" value="{*$row['sp_pname']*}" /><input name="sp_pid" type="hidden" id="sp_pid" value="{*$row['sp_pid']*}" autocomplate="off" /></td>
                                    	<td align="right">&nbsp;</td>
                                    	<td align="left">&nbsp;</td>
                                   	</tr>
                                     <tr>
                                        <td colspan="4" class="stitle">银行账号信息</td>
                                    </tr>
                                    <tr>
                                        <td align="right">账号类型:</td>
                                        <td align="left">
										{*html_options name=bank_type options=$bank_type*}
										<!--<input name="sp_bank_type" type="text" id="sp_bank_type" size="30" maxlength="30" value="{*$row['sp_bank_type']*}" /><span class="red">(如支付宝,招商银行,工商银行)</span>-->
										</td>
                                        <td align="right">&nbsp;</td>
                                        <td align="left">&nbsp;</td>
                                    </tr>
                                    <tr>
                                    	<td align="right">开户人(姓名):</td>
                                    	<td align="left"><input name="sp_bank_name" type="text" id="sp_bank_name" size="30" maxlength="30" value="{*$row['sp_bank_name']*}" /><span class="red">*</span></td>
                                    	<td align="right">卡号(账号):</td>
                                    	<td align="left"><input name="sp_bank_code" type="text" id="sp_bank_code" size="30" maxlength="30" value="{*$row['sp_bank_code']*}" /><span class="red">*</span></td>
                                   	</tr>
									<tr>
                                        <td colspan="4" class="stitle">商户信息</td>
                                    </tr>
                                    <tr>
                                        <td width="11%" align="right">商户名称:</td>
                                        <td width="39%" align="left"><input name="sp_title" type="text" id="sp_title" value="{*$row['sp_title']*}" size="50" maxlength="50" /><span class="red">*</span></td>
                                        <td align="right">联系电话:</td>
                                        <td align="left"><input name="sp_phone" type="text" id="sp_phone" value="{*$row['sp_phone']*}" size="30" maxlength="30" /></td>
                                    </tr>
                                    <tr>
                                        <td align="right">联系人:</td>
                                        <td align="left"><input name="sp_contact" type="text" id="sp_contact" value="{*$row['sp_contact']*}" size="30" maxlength="30" /></td>
                                        <td align="right">QQ:</td>
                                        <td align="left"><input name="sp_qq" type="text" id="sp_qq" value="{*$row['sp_qq']*}" size="30" maxlength="20" /></td>
                                    </tr>
                                    
                                    <tr>
                                        <td align="right">E-mail:</td>
                                        <td align="left"><input name="sp_mail" type="text" id="sp_mail" value="{*$row['sp_mail']*}" size="30" maxlength="50" /></td>
                                        <td align="right">Fax:</td>
                                    	<td align="left"><input name="sp_fax" type="text" id="sp_fax" value="{*$row['sp_fax']*}" size="30" maxlength="50" /></td>
                                    </tr>
                                    <tr>
										<td align="right">域名申请:</td>
                                        <td align="left"><input name="sp_url" type="text" id="sp_url" value="{*$row['sp_url']*}" size="60" maxlength="200" /></td>
                                    	<td align="right">联系地址:</td>
                                    	<td align="left"><input name="sp_addr" type="text" id="sp_addr" value="{*$row['sp_addr']*}" size="60" maxlength="200" /></td>                                    	
                                   	</tr>
									<tr>
                                    <td align="right">logo:</td>
                                    <td align="left" colspan="3">
                                        <span id='sp_logo_show'><img style="cursor:pointer" id="sp_logo_button" src="/public/images/admin/upload.jpg"  /></span>
                                        <input type="hidden" name="sp_logo" id="sp_logo" value="{*$row['sp_logo']*}" />
                                    </td>
                                </tr>
                                    <!-- <tr id="uploadify_part">
                                         <td align="right">已上傳圖片:</td>
                                         <td colspan="3" align="left"><div id="uploadify_list"></div><input type="button" id="uploadify_del" name="uploadify_del" value="删除圖片" class="myinput1"  /></td>
                                     </tr>-->
                                  
                                    <tr>
                                        <td colspan="4" class="stitle">企业注册信息</td>
                                    </tr>
                                    <tr>
                                    <td align="right">营业执照:</td>
                                    <td align="left" colspan="3">
                                        <span id='sp_licence_show'><img style="cursor:pointer" id="sp_licence_button" src="/public/images/admin/upload.jpg"  /></span>
                                        <input type="hidden" name="sp_licence" id="sp_licence" value="{*$row['sp_licence']*}" />
                                    </td>
                                </tr>
                                    <tr>
                                        <td align="right">营业执照号:</td>
                                        <td align="left"><input name="sp_licence_num" type="text" id="sp_licence_num" value="{*$row['sp_licence_num']*}" size="30" maxlength="30" /></td>
                                        <td align="right">注册地址:</td>
                                        <td align="left"><input name="sp_licence_addr" type="text" id="sp_licence_addr" value="{*$row['sp_licence_addr']*}" size="30" maxlength="50" /></td>
                                    </tr>
                                    <tr>
                                        <td align="right">&nbsp;</td>
                                        <td align="left">&nbsp;</td>
                                        <td align="right">&nbsp;</td>
                                        <td align="left">&nbsp;</td>
                                    </tr>									
                                   
                                </tbody>
                            </table>
                          <div class="pt_8" align="center"><input type="submit" name="Submit" value="提 交" class="myinput" />
                                &nbsp;&nbsp;
                            <input type="button" name="back" value="返 回" onclick="window.history.back()" class="myinput" /></div>
                        </form>
                    </div>
                </div>
                <div class="content_main_bottom">
                    <div class="content_main_bottom_left"></div>
                    <div class="content_main_bottom_right"></div>
                </div>
                <div style="display:none"><ul id="copy_info"><li><b><input name="item_name[]" type="text" class="item_name" size="52" /></b><span><input name="item_price[]" type="text" class="item_price ismoney" value="0" size="8"  /></span><span><input name="item_count[]" type="text" class="item_count isnum" value="1" size="8" /></span><span><input name="item_total[]" type="text" class="item_total ismoney" value="0" size="8" readonly="readonly" /></span><span><a href="javascript:void(0)" class="del_item"><img src="public/images/admin/close.png" /></a></span></li></ul></div>
               

                {*else*}

                <script type="text/javascript">
		
                    $(function(){
						
                        $(".test").click(function(){
                            asyncbox.open({
                                url : 'asyncbox.html',
                                width : 400,
                                height : 300,
                                buttons : asyncbox.btn.OKCANCEL //按钮栏配置请参考 "辅助函数" 中的 asyncbox.btn。
                            });
                        })

						
                    })

                </script>
                <div class="pannel">
                    <div class="pl"></div>
                    <div class="pr"></div>
                    <div class="pc">
                        <form action="" method="get" id="search_form" name="search_form">
                            <input name="dpt" id="dpt" type="hidden" value="{*$cf_dpt*}" />
                            <input name="self" id="self" type="hidden" value="{*$self*}" />
                            <div class="pt">
                                代理商全称:
                                	<input type="text" size="20" id="skey" name="skey" class="tet" value="{*$skey*}" />
								&nbsp;&nbsp;账号:<input type="text" size="20" id="skey2" name="skey2" class="tet" value="{*$skey2*}" />
								&nbsp;&nbsp;联系人:<input type="text" size="6" id="skey3" name="skey3" class="tet" value="{*$skey3*}" />
								&nbsp;&nbsp;联系电话: <input type="text" size="12" id="skey4" name="skey4" class="tet" value="{*$skey4*}" />								
                                &nbsp;&nbsp;新增时间:
                                <input name="skey5" class="Wdate" type="text" id="act_start" value="{*$skey5*}" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'act_end\')}',dateFmt:'yyyy-MM-dd',isShowClear:true,readOnly:true});" size="15" maxlength="30" />
                                到<input name="skey6" class="Wdate" type="text" id="act_end" value="{*$skey6*}" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'act_start\')}',dateFmt:'yyyy-MM-dd',isShowClear:true,readOnly:true});" size="15" maxlength="30" />
								&nbsp;&nbsp;
                                <input type="image" src="public/images/admin/icon_search_btn.gif">
                            </div>
                        </form>
                    </div>
                </div>
                <div class="content_panel_title">
                    <div class="contentpanelleft"></div>
                    <div class="contentpanelcenter">
                        <span class="contentpanelcenter_font">代理商管理</span>
                        <span><a class="edit at" href="{*$cf_self_path*}-act_add.htm?dpt={*$cf_dpt*}">新增代理商</a></span>&nbsp;
                        </div>
                    <div class="contentpanelrihgt"></div>
                </div>
                <div class="content_table_center_style">
                    <div class="p8">
                        <div class="bq clearfix">
                            <b><a href="{*$cf_self_path*}-act_index.htm?dpt={*$cf_dpt*}" class="{*if $self==''*}active{*/if*}">所 有 </a></b>
							{*foreach $cf_info_var_common['sp_status'] as $k=>$v*}
							{*if $k==$self && $self!=''*}
							{*assign var=class value='active' *}
							{*else*}
							{*assign var=class value='' *}
							{*/if*}
							<b><a href="{*$cf_self_path*}-act_index.htm?dpt={*$cf_dpt*}&self={*$k*}" class="{*$class*}" >{*$v*}</a></b>
							{*/foreach*}
							
							
							</div>
                        <form name="list_form" id="list_form" method="post" action="{*$cf_self_page*}">
                            <input name="act" type="hidden" value="all" />
                            <input name="dpt" type="hidden" value="{*$cf_dpt*}" />
                            <table width="100%" class="tbl tbl_nbr">
                                <thead>
                                    <tr class="thd">
                                        <td width="4%" align="center" class="thr">ID</td>
                                        <td width="10%" align="center" class="thr">代理商账号</td>
                                        <td width="6%" align="center" class="thr">级别</td>
                                        <td width="15%" align="center" class="thr">代理商全称</td>
                                        <td width="8%" align="center" class="thr">联系人</td>
                                        <td width="10%" align="center" class="thr">联系电话</td>
                                        <td width="5%" align="center" class="thr">资金</td>
                                        <td width="13%" align="center" class="thr">创建时间</td>
                                        <td width="11%" align="center" class="thr">状态</td>
                                        <td colspan="4" align="center" class="thr">操作</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    {*foreach name=lead_part item=item from=$data_ary*}                                   
                                    <tr onmouseout="this.style.backgroundColor='#ffF'" onmouseover="this.style.backgroundColor='#ffC'">
                                        <td align="center">{*$item['sp_id']*}</td>
                                        <td align="left"><a href="javascript:void(0)" title="查看詳情" onclick="$(function(){my_iframe('{*$cf_module_path*}detail-act_sp.htm?id={*$item['sp_id']*}','查看詳情-{*$item['sp_title']*}',750,500)})" class="{*$item['class']*}" >{*$item['sp_name']*}</a></td>
                                        <td align="center">{*$cf_info_var_common['sp_level'][$item['sp_level']]*}</td>
                                        <td align="center">{*$item['sp_title']*}</td>
                                        <td align="center">{*$item['sp_contact']*}</td>
                                        <td align="center">{*$item['sp_phone']*}</td>
                                        <td align="center"><a href="/admin/spmoney.htm?dpt=13&skey2={*$item['sp_id']*}" target="_blank" class="edit">{*$item['sp_money']*}</a></td>
                                        <td align="center">{*$item['sp_reg_time']*}</td>
                                        <td align="center">{*$cf_info_var_common['sp_status'][$item['sp_status']]*}</td>
                                        <td width="6%" align="center"><a href="javascript:void(0)" title="推广链接" onclick="$(function(){my_alert('{*$item['url']*}','操作提示');})"  class="edit">推广链接</a></td>
                                        <td width="4%" align="center"><a href="{*$cf_self_path*}-act_edit_id_{*$item['sp_id']*}.htm?dpt={*$cf_dpt*}" class="edit">修改</a></td>
                                        <td width="4%" align="center"><a href="/admin/withdraw-act_withdraw_id_{*$item['sp_id']*}.htm?dpt={*$cf_dpt*}" target="_blank" class="edit">结账</a></td>
                                        <td width="4%" align="center"><a href="{*$cf_self_path*}-act_del_id_{*$item['sp_id']*}.htm?dpt={*$cf_dpt*}" onclick="return confirm('你确定要删除吗?')" class="del">删除</a></td>
                                    </tr>

                                    {*/foreach*}


                                    <tr class="tft">
                                        <td colspan="13" style="padding:0;">
                                            <table width="100%" border="0">
                                                <tr>
                                                    <td width="2%" align="center" style="border:0;padding:0;"><!--<input type="button" name="checkall" id="checkall" class="myinput" value="全 选" />--></td>
                                                    <td width="11%" align="center" style="border:0;padding:0;">
                                                        <!-- <select name="alltype" id="alltype">
                                                            <option selected="selected" value="">操作選擇</option>
                                                           <option value="allcheck">通過審核</option>
                                                            <option value="alloutcheck">審核不通過</option>
                                                        </select>
                                                        &nbsp;<input type="submit" name="submit_all" id="submit_all" value="批量操作" class="myinput" />--></td>
                                                    <td width="87%" style="border:0;padding:0;" ><div class="turnPage"><p>{*$page*}</p></div></td>
                                                </tr>
                                            </table>                                </td>
                                    </tr>
                                </tbody>
                            </table>
                        </form>
                    </div>
                </div>
                <div class="content_main_bottom">
                    <div class="content_main_bottom_left"></div>
                    <div class="content_main_bottom_right"></div>
                </div>

                {*/if*}
            </div>        </td>
    </tr>
</table>
{*include file="template/admin_foot.htm"*}